package com.allo2o.common.convertor;

import com.allo2o.common.VO.AgencyVO;
import com.allo2o.common.domain.AgencyDO;
import org.springframework.beans.BeanUtils;

/**
 * Created by mclubing on 16-6-14.
 * Entry convertor
 *
 * @author mclubing
 */
public class AgencyConvertor {

    /**
     * <ul>
     * convert AgencyVO to AgencyDO
     * </ul>
     *
     * @param vo AgencyVO
     * @return AgencyDO
     */
    public static AgencyDO VO2DOConvert(AgencyVO vo) {
        if (vo == null) {
            return null;
        } else {
            AgencyDO dto = new AgencyDO();
            BeanUtils.copyProperties(vo, dto);
            return dto;
        }
    }

    /**
     * <ul>
     * convert AgencyDO to AgencyVO
     * </ul>
     *
     * @param dto AgencyDO
     * @return AgencyVO
     */
    public static AgencyVO DO2VOConvert(AgencyDO dto) {
        if (dto == null) {
            return null;
        } else {
            AgencyVO vo = new AgencyVO();
            BeanUtils.copyProperties(dto, vo);
            vo.setPassword("******");
            return vo;
        }
    }
}
